package com.lm.pojo;

import lombok.Data;

/**
 * 聊天消息模型
 */
@Data
public class ChatMessage {
    // 消息类型：ALL表示广播消息，USER表示点对点消息
    private String type;
    // 发送者
    private String from;
    // 接收者，当type为USER时有效
    private String to;
    // 消息内容
    private String content;
    // 消息时间
    private long timestamp;
    // 新增角色字段：DOCTOR表示医生，USER表示普通用户
    private String role;
    
    // 构造函数更新
    public ChatMessage() {
        this.timestamp = System.currentTimeMillis();
    }
    
    public ChatMessage(String type, String from, String to, String content) {
        this.type = type;
        this.from = from;
        this.to = to;
        this.content = content;
        this.timestamp = System.currentTimeMillis();
    }

    // 添加带角色的构造函数
    public ChatMessage(String type, String from, String to, String content, String role) {
        this.type = type;
        this.from = from;
        this.to = to;
        this.content = content;
        this.role = role;
        this.timestamp = System.currentTimeMillis();
    }
}